<?php
//验证登陆信息
session_start();


include_once ("../config.php");





$cid=$_REQUEST['token'];


//如果有传递token过来
//如果有传递token过来
if($cid)
{


	$table_suffix="user";
	$table=$table_Prefix.$table_suffix;
	$user=select_one_line_all_items($table,"cid='".$cid."'");


	//print_r2($user);



	//搜索到用户
	if($user['name'])
	{
		$_SESSION['username']     = $user['name'];
		$_SESSION['department']   = $user['department'];
		$_SESSION['departmentid'] = $user['departmentid'];
		$_SESSION['mid']          = $user['mid'];
		$_SESSION['nid']          = $user['nid'];
		$_SESSION['quanxian']     = $user['quanxian'];
		$_SESSION['position']     = $user['position'];
		$_SESSION['cid']          = $user['cid'];




//管理员自动扔去后台
if(
  ( $_SESSION['quanxian']=="caiwu") || ( $_SESSION['quanxian']=="chufang") || ( $_SESSION['quanxian']=="admin")
  )
{
echo "<script language='javascript'> location='../controlbase/';</script>";
}


else
{
	//普通用户去订餐
	echo "<script language='javascript'>location='/front/m2/order-list.php';</script>";
}



}//管理员自动扔去后台


	//搜索到用户
	else{
		//cid没用户信息
		echo "<script language='javascript'>location='/login/';</script>";
	}






}





//如果有传递token过来
//如果有传递token过来
else
{
//没有带cid
echo "<script language='javascript'>location='/login/';</script>";
}



?>



</body>